﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WebNext.Domain.Entities;
using WebNext.Domain.Interfaces;

namespace WebNext.DataAccess.Repositories
{
	public class AuthorInfoRepository : EntitiesRepository<AuthorInfo>, IAuthorInfoRepository
	{
		public CultureId CultureId
		{
			get;
			set;
		}

		public AuthorInfoRepository(IDatabaseContext databaseContext): base(databaseContext)
		{
		}

		public AuthorInfo GetAuthorInfo()
		{
			return this.databaseContext.Session.QueryOver<AuthorInfo>().Where(i => i.CultureId == this.CultureId).OrderBy(s => s.CreatedOn).Desc.Take(1).SingleOrDefault();
		}
	}
}
